<?php
global $TanTanConfig;
if ('open' != $post->comment_status) return; 
?>
<div id="comments">
<?php // Do not delete these lines
if (!empty($post->post_password)) { // if there's a password
    if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
?>
    <p class="error">This post is password protected. Enter the password to view comments.<p>
<?php
    return;
    }
}
?>


<?php if (is_array($comments)) : ?>
	<h4 id="num-comments"><?php comments_number('No comments', '<span class="num">One</span> comment', '<span class="num">%</span> comments' );?></h4> 
	<ol>
	    
	<?php 
	if ($TanTanConfig['MaxComments']) {
	    $comments = array_slice($comments, count($comments) - $TanTanConfig['MaxComments'] );
	}
	$i=0; foreach ($comments as $k=>$comment) : ?>
	   <?php if ($comment->comment_type == 'pingback'): ?>
	   <li class="pingback" id="comment-<?php comment_ID() ?>">
	   Pingback: <?php comment_author_link() ?>
	   </li>
	   <?php else: ?>
		<li class="<?php echo (($i++ % 2 == 0) ? 'odd' : 'even')?><?php echo ($comment->comment_author_email == 'joetan54@gmail.com' ? ' joe' : '');?>" id="comment-<?php comment_ID() ?>">
			<a href="#comment-<?php comment_ID() ?>" title="Comment Link" class="comment-link">#</a>
			
			<cite><?php /*<img src="<?php gravatar("PG", 40, "http://tantannoodles.com/wp-content/themes/tantan/images/gravatar.gif"); ?>" class="gravatar" /> */ ?><?php comment_author_link() ?></cite>
			<span class="date"><?php comment_date('M d, Y') ?></span><br>
			<?php if ($comment->comment_approved == '0') : ?>
            <p class="error">Your comment is awaiting moderation.</p>
			<?php endif; ?>
            <div class="comment-text"><?php comment_text() ?></div>
		</li>
		<?php endif; ?>
	<?php endforeach; /* end for each comment */ ?>

	</ol>
	<?php if ($TanTanConfig['MaxComments']): ?>
	<p id="view-all-comments">
	<a href="<?php the_permalink();?>?comments=1#comments">View all <?php comments_number('No comments', '<span class="num">One</span> comment', '<span class="num">%</span> comments' );?></a>
    </p>
	<?php endif;?>

 <?php else : // this is displayed if there are no comments so far ?>

  <?php if ('open' == $post->comment_status) : ?> 
		<!-- If comments are open, but there are no comments. -->
		
	 <?php else : // comments are closed ?>
		<?if (!is_page()): ?>
		<p class="nocomments">Comments are closed.</p>
		<?endif;?>
	<?php endif; ?>
<?php endif; ?>


<?php if ('open' == $post->comment_status) : ?>

<h4>Leave a comment</h4>

<?php include('comments-form.php');?>

<?php endif; // if you delete this the sky will fall on your head ?>
</div>
